<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Envir extends Base{
    //PC资讯
    public function envirs(){
        if(!empty(input("param.cus_id"))){
            $cus_id=input("param.cus_id");
        }else{
            return json(['code' => 501, 'msg' => '请给出客户id']);exit();
        }
        $customer=Db::name('customer')->where('id',$cus_id)->where('state',1)->find();
        if($customer){
            $tnews=Db::name('envir')->where('cus_id',$cus_id)->where('state',1)->order('sort desc')->select();
            if($tnews){
                return json(['code' => 200, 'msg' => '成功！','data'=>$tnews]);exit();
            }else{
                return json(['code' => 500, 'msg' => '查无数据！']);exit();
            }
        }else{
            return json(['code' => 502, 'msg' => '此客户不存在或者被禁用了！']);exit();
        }
    }
}